package cn.zyl.demo.common.enums;

/**
 * SexEnum类说明: 性别枚举，1男，2女，9未知
 *
 * @author wsz
 * @version v1.0
 * @date 2020-08-04
 */
public enum SexEnum {
    /** 男-m-1*/
    MEN(1,'m',"男"),
    /** 女-w-2*/
    WOMEN(2,'w',"女"),
    /** 未知-u-9*/
    UNKNOWN(9,'u',"未知")
    ;
    /**状态*/
    private final Integer status;
    /**名称*/
    private final String value;
    /**英文简写*/
    private final Character en;
    SexEnum(Integer status,Character en, String value) {
        this.status = status;
        this.value = value;
        this.en = en;
    }
    public Integer getStatus() {
        return status;
    }
    public String getValue() {
        return value;
    }
    public Character getEn() { return en; }
    public static String toValue(Integer status){
        if(null == status){return null;}
        if(MEN.status.equals(status)){return MEN.value;}
        if(WOMEN.status.equals(status)){return WOMEN.value;}
        if(UNKNOWN.status.equals(status)){return UNKNOWN.value;}
        return null;
    }
    public static String toValue(Character en){
        if(null == en){return "";}
        if(MEN.en.equals(en)){return MEN.value;}
        if(WOMEN.en.equals(en)){return WOMEN.value;}
        if(UNKNOWN.en.equals(en)){return UNKNOWN.value;}
        return null;
    }
    public static boolean contains(String value){
        return MEN.value.equals(value) || WOMEN.value.equals(value) || UNKNOWN.value.equals(value);
    }
    public static boolean contains(Integer status){
        return MEN.status.equals(status) || WOMEN.status.equals(status) || UNKNOWN.status.equals(status);
    }
    public static boolean contains(Character en){
        return MEN.en.equals(en) || WOMEN.en.equals(en) || UNKNOWN.en.equals(en);
    }
}
